from toee import *
from utilities import *

def san_dialog( attachee, triggerer ):
	triggerer.turn_towards(attachee)
	triggerer.begin_dialog( attachee, 1 )	
	return SKIP_DEFAULT

def san_heartbeat( attachee, triggerer ):
	if (is_better_to_talk(attachee, game.party[0])):
		attachee.turn_towards(game.party[0])
		game.party[0].begin_dialog( attachee, 1 )
	return RUN_DEFAULT

def run_off( attachee, triggerer ):
	for pc in game.party:
		attachee.ai_shitlist_remove( pc )
	attachee.runoff(attachee.location-3)
	return RUN_DEFAULT

def is_better_to_talk(speaker,listener):
	if (speaker.can_see(listener)):
		if (speaker.distance_to(listener) <= 10):
			return 1
	return 0